home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Atlanta_1990 / Atlanta-Devcon.2 / Libraries / Locale / getmsg.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-26  |  1.1 KB  |  57 lines

  1. /*
  2.  * Copyright (C) 1990 Commodore-Amiga, Inc.
  3.  * All rights reserved
  4.  */
  5.  
  6. /* locale.library example.
  7.  * Compiled with lc -cfist -v -L getmsg.c
  8.  *
  9.  * Usage:
  10.  * 
  11.  * 1> catgen catexample.src <catalogue> ; Generate catalogue
  12.  * 1> getmsg <catalogue> <msg_number>   ; get local message
  13.  *
  14.  * See Readme.
  15.  */
  16.  
  17. #include <exec/types.h>
  18. #include <exec/lists.h>
  19. #include <exec/libraries.h>
  20. #include <clib/exec_protos.h>
  21.  
  22. #include <locale/localebase.h>
  23. #include <locale/locale.h>
  24. #include "protos/locale_protos.h"
  25. #include "pragmas/locale_pragmas.h"
  26.  
  27. #include <stdio.h>
  28. #include <stdlib.h>
  29.  
  30. int main(int, char **);
  31.  
  32. int main(int argc, char *argv[])
  33. {
  34.     APTR *LocaleBase;
  35.     char *str;
  36.     struct Catalogue *catalogue;
  37.  
  38.     LocaleBase = (APTR)OpenLibrary("locale.library",NULL);
  39.  
  40.     if (LocaleBase == NULL)
  41.     {
  42.         printf("Could not open locale.library!\n");
  43.         exit(10);
  44.     }
  45.  
  46.     if (!(catalogue = CatOpen(argv[1],NULL)))
  47.     {
  48.         printf("Could not open catalogue '%s'\n",argv[1]);
  49.     }
  50.     str = CatGets(catalogue,1,atoi(argv[2]),"This is a default message\n");
  51.     printf(str);
  52.     CatClose(catalogue);
  53.     CloseLibrary((struct Library *)LocaleBase);
  54.     return(NULL);
  55. }
  56.  
  57.